home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / fansi.zip / NANSI.DOC < prev    next >
Text File  |  1987-01-21  |  9KB  |  212 lines

  1. nansi    - enhanced MS-DOS ansi console driver
  2.  
  3. SYNOPSIS
  4.     Include in \config.sys the line
  5.         DEVICE=NANSI.SYS
  6.  
  7. DESCRIPTION
  8.     Nansi.sys is a console driver which understands ANSI control sequences.
  9.     It has several advantages over ANSI.SYS (the driver supplied with DOS):
  10.     1. It supports new escape sequences (see below).
  11.     2. It provides MUCH faster output under certain conditions.
  12.     3. It supports the 43-line mode of the EGA.
  13.     4. The darned bell is now 1/4 second instead of 1/2 second long.
  14.  
  15.     What a console driver does:
  16.     When you, for example, type
  17.         C:> type foo.txt
  18.     COMMAND.COM opens the file foo.txt, reads it, and writes it to
  19.     the console driver, which puts it up on the screen.
  20.  
  21.     Both ansi.sys and nansi.sys use IBM Video BIOS to control the screen.
  22.     However, nansi.sys bypasses BIOS if the screen is in a text mode; this
  23.     allows much faster operation under certain conditions.
  24.  
  25.     While putting text up on the screen, (n)ansi.sys keeps a lookout for
  26.     the escape character (chr(27), known as ESC); this character signals
  27.     the start of a terminal control sequence.
  28.     Terminal control sequences follow the format
  29.         ESC [ param; param; ...; param cmd
  30.     where
  31.         ESC    is the escape character chr$(27).
  32.         [    is the left bracket character.
  33.         param    is an ASCII decimal number, or a string in quotes.
  34.         cmd    is a case-specific letter identifying the command.
  35.     Usually, zero, one, or two parameters are given.  If parameters
  36.     are omitted, they usually default to 1; however, some commands
  37.     (KKR and DKOCT) treat the no-parameter case specially.
  38.     Spaces are not allowed between parameters.
  39.  
  40.     For example, both ESC[1;1H and ESC[H send the cursor to the home
  41.     position (1,1), which is the upper left.
  42.  
  43.     Either single or double quotes may be used to quote a string.
  44.     Each character inside a quoted string is equivalent to one numeric
  45.     parameter.  Quoted strings are normally used only for the Keyboard
  46.     Key Reassignment command.
  47.  
  48. Control Sequences
  49.     The following table lists the sequences understood by nansi.sys.
  50.     Differences between nansi.sys and the standard ansi.sys are marked
  51.     with a vertical bar (|).
  52.  
  53. Cursor Positioning
  54. Short    Long name        Format        Notes
  55. CUP    cursor position        ESC[y;xH    Sets cursor position.
  56. HVP    cursor position        ESC[y;xf    Same as CUP; not recommended.
  57. CUU    cursor up        ESC[nA        n = # of lines to move
  58. CUD    cursor down        ESC[nB
  59. CUF    cursor forward        ESC[nC        n = # of columns to move
  60. CUB    cursor backward        ESC[nD
  61. DSR    Device Status, Report!    ESC[6n        Find out cursor position.
  62. CPR    Cursor Position report    ESC[y;xR<CR>    Response to DSR, as if typed.
  63. SCP    Save Cursor Position    ESC[s        Not nestable.
  64. RCP    Restore Cursor Position ESC[u
  65.  
  66. Editing
  67. ED    Erase in Display    ESC[2J    Clears screen.
  68. EL    Erase in Line        ESC[K    Clears to end of line.
  69. IL  |    Insert Lines        ESC[nL    Inserts n blank lines at cursor line.
  70. DL  |    Delete Lines        ESC[nM    Deletes n lines, including cursor line.
  71. ICH |    Insert Characters    ESC[n@    Inserts n blank chars at cursor.
  72. DCH |    Delete Characters    ESC[nP    Deletes n chars, including cursor char.
  73.  
  74.  
  75. Mode-Setting
  76. SGR    Set Graphics Rendition    ESC[n;n;...nm    See character attribute table.
  77. SM    Set Mode        ESC[=nh        See screen mode table.
  78. RM    Reset Mode        ESC[=nl        See screen mode table.
  79. IBMKKR    Keyboard Key Reass.    ESC["string"p
  80.     The first char of the string gives the key to redefine; the rest
  81.     of the string is the key's new value.
  82.     To specify unprintable chars, give the ASCII value of the char
  83.     outside of quotes, as a normal parameter.
  84.     IBM function keys are two byte strings; see the IBM Basic manual.
  85.     For instance, ESC[0;";dir a:";13;p redefines function key 1 to
  86.     have the value "dir a:" followed by the ENTER key.
  87.       | If no parameters given, all keys are reset to their default values.
  88.  
  89. DKOCT | Output char translate    ESC[n;ny
  90.       | When first char is encountered in output request, it is replaced with
  91.       | the second char.  This might be useful for previewing text before
  92.       | sending it to a printer with a funny print wheel.
  93.       | If no parameters are given, all chars are reset to normal.
  94.  
  95.  
  96. Character Attributes
  97.     The Set Graphics Rendition command is used to select foreground
  98.     and background colors or attributes.
  99.     When you use multiple parameters, they are executed in sequence, and
  100.     the effects are cumulative.
  101.        Attrib code        Value
  102.         0        All attributes off (normal white on black)
  103.         1        Bold
  104.         4        Underline
  105.         5        Blink
  106.         7        Reverse Video
  107.         8        Invisible (but why?)
  108.         30-37        foregnd blk/red/grn/yel/blu/magenta/cyan/white
  109.         40-47        background
  110.  
  111. Screen Modes
  112.     The IBM BIOS supports several video modes; the codes given in the
  113.     BIOS documentation are used as parameters to the Set Mode command.
  114.       | (In bitmap modes, the cursor is simulated with a small blob (^V).)
  115.         Mode Code        Value
  116.         0        text 40x25 Black & White
  117.         1        text 40x25 Color
  118.         2        text 80x25 Black & White
  119.         3        text 80x25 Color
  120.         4        bitmap 320x200 4 bits/pixel
  121.         5        bitmap 320x200 1 bit/pixel
  122.         6        bitmap 640x200 1 bit/pixel
  123.         7        (cursor wrap kludge)
  124.         13        bitmap 320x200 4 bits/pixel
  125.         14        bitmap 640x200 4 bits/pixel
  126.         15        [ IBM Monochrome display 640x350 2 bits/pixel?]
  127.         16        bitmap 640x350 4 bits/pixel [with full 256K]
  128.     Mode 7 is an unfortunate kludge; Setting mode 7 tells the cursor
  129.     to wrap around to the next line when it passes the end of a line;
  130.     Resetting mode 7 tells the cursor to not wrap, but rather stay put.
  131.       | If your computer has the Enhanced Graphics Adaptor, modes between
  132.       | 8 and 15 are also supported; see the EGA BIOS for info.
  133.       | The EGA also lets you use a shorter character cell in text modes
  134.       | in order to squeeze 43 lines of text out of the 25-line text modes.
  135.       | To enter 43 line mode, set the desired 25-line text mode (0 to 3),
  136.       | then Set Mode 43.  For instance: ESC[=3h ESC[=43h.
  137.       | To exit 43 line mode, set the desired 25-line text mode again.
  138.       | Nansi.sys ignores mode 43 unless there is an EGA on your computer.
  139.  
  140. Faster Output
  141.       | Any program that sets the console to RAW mode, and buffers its
  142.       | output properly, can achieve extremely high screen update speeds in
  143.       | return for giving up the special functions of the keys ^C, ^S, and ^P.
  144.       | See IOCTL in the MS-DOS 3.x Technical Reference for more info.
  145.     Also, a small improvement in speed may be noticed with some
  146.     programs that use the DOS console in normal mode, as this driver
  147.     efficiently implements the (standard but undocumented) INT 29h
  148.     most-favored-device putchar used by DOS.
  149.  
  150. EXAMPLES
  151.     See the files setraw.* for Macro Assembler, Lattice C,
  152.     and Microsoft C routines for entering and leaving raw mode.
  153.  
  154.     The files mode*.txt included with nansi.sys in the library
  155.     new_ansi.lbr contain the Set Mode sequences to set various
  156.     screen modes; for instance, to try out 43 line mode, type
  157.         C:> type MODE43.TXT
  158.     [ To get back to normality, type the file "mode3.txt"; don't use
  159.       the mode command, as that doesn't let nansi know what happened...]
  160.  
  161.     The programs view.com and more.com are demos of this driver's
  162.     blinding screen update speed; refer to view.doc and more.doc for
  163.     details.  Briefly, typing
  164.         C:> more foo.txt
  165.     shows you the file foo.txt, pausing every 24 lines for you to hit
  166.     the spacebar.  Typing
  167.         C:> view foo.txt
  168.     shows you the first page of the file foo.txt; typing PgUp or PgDn moves
  169.     you backwards or forwards in the file; typing 'q' exits to DOS.
  170.  
  171. BUGS
  172.     Insert and delete character do not work in graphics modes.
  173.  
  174.     Graphics mode writing is slow.
  175.  
  176.     In graphics mode, the simulated cursor slows down single-char
  177.     writes and screws up CED.COM; there should be a way to turn it off.
  178.  
  179.     Does not support erase-to-end-of-screen and other useful functions.
  180.  
  181.     Cursor Position Report has a carriage return in it, which is what
  182.     ansi.sys does, but is nonstandard.
  183.  
  184.     When using 43 line mode, typing MODE CO80 will get you back
  185.     to 25 line mode- but NANSI will still scroll as if there were 43
  186.     lines!  You have to use the SET MODE escape sequence instead of MODE.
  187.  
  188. Version
  189.     (The version number can be found by typing TYPE NANSI.SYS.)
  190.     This version, 2.2, created February 1986.
  191.     Problems should    be reported to Daniel Kegel:
  192.     before 7/86: 1-60 CIT, Pasadena, CA 91126 or (on Arpanet)
  193.             kegel@juliet.caltech.edu
  194.     after 8/86: 2648 169th Ave SE, Bellevue, WA 98008 or (on usenet)
  195.             ...seismo!rochester!srs!dan
  196.     Your suggestions for improvement would be most welcome.
  197.  
  198. NOTE
  199.     This program may be distributed for educational and personal use
  200.     only.  Commercial use is verboten; get in touch with the author.
  201.  
  202. FILES
  203.     nansi.doc    - this file
  204.     view.*        - a fast VI-like file viewer, documentation
  205.     more.*        - a fast page-at-a-time TYPE command, documentation
  206.     unsetraw.com    - program to set/unset RAW mode from DOS command line
  207.     setraw.*    - how to set ms-dos RAW mode (for fast output)
  208.         setraw.asm    - for assembly programs
  209.         setraw.msc    - for Microsoft C programs
  210.         setraw.lc    - for Lattice C programs
  211.         rawtest.lc    - example for Lattice C only
  212.